Vitest config merging improvements#32810
Conversation
… configuration When a user specifies `test.exclude` inside their `vitest.config.ts`, the tests are correctly excluded during Vitest's execution phase. However, because the Angular CLI extracts test files earlier in the process using its own `exclude` builder option, those skipped tests are still unnecessarily compiled by esbuild in-memory. This adds a warning to explicitly notify developers of this hidden build overhead and suggests using the Angular CLI `exclude` option instead to improve performance.
There was a problem hiding this comment.
Code Review
This pull request introduces several valuable improvements to how Vitest configurations are merged, addressing potential conflicts between CLI options and user-defined configurations. The changes to prioritize CLI arguments for reporters and to warn about performance implications of test.exclude are well-implemented. The new logic for merging coverage.exclude arrays is also a good step towards more intuitive behavior. However, I've identified a potential issue in the implementation of the coverage.exclude merging that could lead to incorrect behavior under certain conditions. The new tests are comprehensive and validate the intended changes effectively.
27dfcf6 to
bbf5621
Compare
Previously, providing a --coverage-exclude CLI option to the builder would completely clobber any custom coverage.exclude items defined natively within vitest.config.ts. This correctly merges both sources using an internal Set to prevent duplicate exclusions and preserves configurations so developers can combine global ignores alongside CLI-specific boundaries.
…ding Vitest configuration When leveraging the Angular CLI to run tests with a specific set of `--reporters`, Vitest's underlying `mergeConfig` logic would normally array-concatenate the CLI reporters with any reporters defined natively inside `vitest.config.ts`. This led to duplicate output processors (e.g. running 'default' twice). By explicitly wiping the original configurations when CLI overrides are present, the CLI now acts as a strict Source-of-Truth array replacer, which is the expected behavior for CI and custom targets.
bbf5621 to
58bcba8
Compare
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR introduces several architectural improvements to how the Angular CLI (
@angular/build) merges and processes customvitest.config.tsoptions.Previously, certain CLI arguments would either silently clobber user-defined configuration arrays, or allow Vite's mergeConfig to create duplicated outputs. Additionally, we identified areas where
vitest.config.tsproperties could cause hidden performance overheads.